package com.caocaog.market.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.caocaog.market.entity.GoodsSort;
import com.caocaog.market.mapper.GoodsSortMapper;
import com.caocaog.market.service.IGoodsSortService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 商品分类表
 * @Author: jeecg-boot
 * @Date: 2021-11-11
 * @Version: V1.0
 */
@Service
public class GoodsSortServiceImpl extends ServiceImpl<GoodsSortMapper, GoodsSort> implements IGoodsSortService {

    @Override
    public IPage<GoodsSort> queryGoodsSortPage(Page<GoodsSort> page, GoodsSort goodsSort) {
        return super.baseMapper.queryGoodsSortPage(page, goodsSort);
    }

    @Override
    public List<GoodsSort> getShopSortList(String shopId) {
        List<GoodsSort> goodsSortList = super.baseMapper.selectList(new QueryWrapper<GoodsSort>()
                .eq("shop_id", shopId)
                .eq("is_show", 1)
                .eq("del_flag", 0)
                .orderByDesc("sort"));
        return goodsSortList;
    }

    @Override
    public List<GoodsSort> getShopSortListForSDX(String shopId) {
        List<GoodsSort> goodsSortList = super.baseMapper.selectList(new QueryWrapper<GoodsSort>()
                .eq("shop_id", shopId)
                .eq("is_show", 1)
                .eq("del_flag", 0)
                .orderByDesc("sort"));
        return goodsSortList;
    }

}
